

package GUIs;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class MainUI extends Frame implements WindowListener,ActionListener{

    protected JFrame frame;

    public void show()
    {
        frame = new JFrame("Joe's Fish Bar - SCMS");
        JPanel panel = new JPanel();

        JButton displayInventoryButton = new JButton("Display Inventory");
        JButton createInventoryItem = new JButton("Create Inventory Item");
        JButton deleteInventoryItem = new JButton("Delete Inventory Item");
        JButton editInventoryItem = new JButton("Edit Inventory Item");
        JButton editInventoryAmount = new JButton("Edit Inventory Amount");

        frame.setSize(256, 256);
        frame.setDefaultCloseOperation(frame.EXIT_ON_CLOSE);
        frame.getContentPane().add(panel);
        panel.add(displayInventoryButton);
        panel.add(createInventoryItem);
        panel.add(deleteInventoryItem);
        panel.add(editInventoryItem);
        panel.add(editInventoryAmount);
        frame.setLocationRelativeTo(null);

        displayInventoryButton.addActionListener(this);
        displayInventoryButton.setActionCommand("display");

        createInventoryItem.addActionListener(this);
        createInventoryItem.setActionCommand("create");
        
        deleteInventoryItem.addActionListener(this);
        deleteInventoryItem.setActionCommand("delete");
        
        editInventoryItem.addActionListener(this);
        editInventoryItem.setActionCommand("edit name");
        
        editInventoryAmount.addActionListener(this);
        editInventoryAmount.setActionCommand("edit amount");




        //frame.pack();
        frame.setVisible(true);
    }

    public void actionPerformed(ActionEvent e)
    {
        String action;
        action = e.getActionCommand();
        
        if (action.equals("display"))
        {
            DisplayInventoryUI displayInv = new DisplayInventoryUI();
            displayInv.show();
            frame.setVisible( false );
            frame.dispose();
        }
        else if (action.equals("create"))
        {
            CreateInventoryItemUI createItem = new CreateInventoryItemUI();
            createItem.show();
            frame.setVisible( false );
            frame.dispose();
        }
        else if (action.equals("delete"))
        {
            DeleteInventoryItemUI deleteItem = new DeleteInventoryItemUI();
            deleteItem.show();
            frame.setVisible( false );
            frame.dispose();
        }
        else if (action.equals("edit name"))
        {
            EditInventoryItemNameUI editName = new EditInventoryItemNameUI();
            editName.show();
            frame.setVisible( false );
            frame.dispose();
        }
        else if (action.equals("edit amount"))
        {
            EditInventoryItemAmountUI editAmount = new EditInventoryItemAmountUI();
            editAmount.show();
            frame.setVisible( false );
            frame.dispose();
        }
    }

	public void windowClosing(WindowEvent e) {
		dispose();
		System.exit(0);
	}

	public void windowOpened(WindowEvent e) {}
	public void windowActivated(WindowEvent e) {}
	public void windowIconified(WindowEvent e) {}
	public void windowDeiconified(WindowEvent e) {}
	public void windowDeactivated(WindowEvent e) {}
	public void windowClosed(WindowEvent e) {}


    public static void MainUI()
    {

    }

}
